<?php
/**
 * 订餐设置model
 */
class RestaurantstyyInfoModel extends BaseModel{
	protected $tableName='restaurantstyy_info';

	/**
	 *给餐厅评分
	 * @param array $condition
	 * @param int $score1 口味分
	 * @param int $score2 送达分
	 * @param int $score3 质量分
	 * @return bool
	 */
	public function comment($condition,$score1,$score2,$score3){
		$restaurant = D('RestaurantstyyInfo')->where($condition)->find();
		$data = array(
			'score' => $restaurant['score']+$score1,
			'score_send' => $restaurant['score_send']+$score2,
			'score_zl' => $restaurant['score_zl']+$score3,
			'user_num' => $restaurant['user_num']+1,
			'user_num2' => $restaurant['user_num2']+1,
			'user_num3' => $restaurant['user_num3']+1,
		);
		$res = D('RestaurantstyyInfo')->where($condition)->save($data);
		if($res){
			return true;
		}else{
			return false;
		}
	}
}